package com.zq.mycloud.auth.controller;

import com.zq.mycloud.auth.entity.UserInfo;
import com.zq.mycloud.auth.service.UserService;
import com.zq.mycloud.core.respones.GeneralResult;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.constraints.NotNull;

/**
 * @author ：zhang qiang
 * @package :com.zq.mycloud.auth.controller
 * @date ：Created in 2020/11/17 上午9:31
 * @description：
 * @modified By：
 * @version: $
 */
@RestController
@RequestMapping("/api/v1/users")
public class UserController {

    @Resource
    private UserService userService;

    @GetMapping("/{userId}")
    public GeneralResult<UserInfo> getUser(@PathVariable("userId") @NotNull String userId,
                                           @RequestHeader(name = "token", required = false) String token,
                                           @RequestHeader(name = "userInfo", required = false) String userInfo,
                                           @RequestHeader(name = "userId", required = false) String userId1) {
        final UserInfo userInfo1 = userService.getUserById(userId);
        return new GeneralResult<>(userInfo1);
    }
}
